using System;
using SemWeb;
using SemWeb.Query;

namespace SemWebTest1
{
    public static class SemwebTest1
    {
        public static void Main(string[] args)
        {
            Test1();
        }

        public static void Test1()
        {
            string needsLocation = "http://localhost:81/ontologies/2007/02/Test/needs.n3";
            string testLocation = "http://localhost:81/ontologies/2007/02/Test/test.n3";
            string filterLocation = "http://localhost:81/ontologies/2007/02/Test/filter.n3";
            string needsBase = needsLocation + "#";
            string needs = needsBase + "needs";
            string mightSelect = needsBase + "mightSelect";
            MemoryStore store = new MemoryStore();
            store.Import(N3Reader.LoadFromUri(new Uri(needsLocation)));
            store.Import(N3Reader.LoadFromUri(new Uri(testLocation)));
            store.Import(N3Reader.LoadFromUri(new Uri(filterLocation)));
            N3Writer n3w = new N3Writer(Console.Out);
            Console.WriteLine("needs predicates:");
            store.Select(new Statement(null, needs, null), n3w);
            Console.WriteLine();
            Console.WriteLine("all:");
            store.Select(n3w);
            Console.ReadKey();
            Statement[] graph = new Statement[] {new Statement(null, needs, null)};
            QueryOptions options = new QueryOptions();
            QueryResultSink sink = new SparqlXmlQuerySink(Console.Out);
            store.Query(graph, options, sink);
            Console.ReadKey();
        }
    }
}